from typing import Optional, List, Union, Any
from pydantic import BaseModel, Field

from app.schemas.base import BaseEntity, PageQuery


class RoleQuery(PageQuery):
    """角色查询参数"""
    roleName: Optional[str] = None
    roleKey: Optional[str] = None
    status: Optional[str] = None


class RoleVO(BaseEntity):
    """角色视图对象 - 匹配RuoYi sys_role表结构"""
    roleId: int
    tenantId: str
    roleName: str
    roleKey: str
    roleSort: int
    dataScope: str
    menuCheckStrictly: int = 1  # 使用int匹配数据库
    deptCheckStrictly: int = 1  # 使用int匹配数据库
    status: str
    delFlag: str
    remark: Optional[str] = None
    admin: bool = False
    menuIds: List[int] = []
    deptIds: List[int] = []


class RoleForm(BaseModel):
    """角色表单 - 匹配RuoYi sys_role表结构"""
    roleId: Optional[int] = None
    roleName: str
    roleKey: str
    roleSort: int = 0
    dataScope: str = "1"
    menuCheckStrictly: int = 1
    deptCheckStrictly: int = 1
    status: str = "0"
    remark: Optional[str] = None
    menuIds: List[int] = []
    deptIds: List[int] = []